<template>
  <div>
    <div class="title">
      {{ titleList[titleIndex] }}
    </div>
    <div class="displayArea">
      <div
        class="productionItem"
        v-for="(productItem, index) in productDetail.items"
        :key="index"
      >
        <img :src="productItem.img_url" />
        <div class="textArea">
          <i>{{ productItem.product_name }}</i>
          <span>{{ productItem.product_brief }}</span>
          <strong class="price">¥{{ productItem.product_price }}</strong>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Production",
  data() {
    return {
      titleList: [
        "新品速递",
        "小家电",
        "耳机音箱",
        "品质灯具",
        "便捷出行",
        "个护清洁",
        "儿童专区",
        "配件耗材",
      ],
    };
  },
  props: ["titleId", "productDetail"],
  computed: {
    titleIndex() {
      return this.titleId - 1;
    },
  },
};
</script>

<style scoped lang="less">
.title {
  background-color: rgb(240, 241, 243);
  height: 0.5rem;
  line-height: 0.5rem;
  text-align: center;
  font-size: 0.18rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.displayArea {
  width: 3.75rem;
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  background-color: rgb(240, 241, 243);
  .productionItem {
    width: 30%;
    margin: 0.08rem 0;
    img {
      width: 1.151rem;
      border-radius: 0.04rem;
      display: block;
    }
    .textArea {
      width: 1.151rem;
      font-size: 0.12rem;
      box-sizing: border-box;
      padding: 0.04rem 0.04rem;
      background-color: #fff;
      border-radius: 0 0 0.03rem 0.04rem;
      i {
        font-weight: 700;
        color: #3c3c3c;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        display: block;
        text-overflow: ellipsis;
      }
      span {
        color: #3c3c3c;
        white-space: nowrap;
        overflow: hidden;
        display: block;
        text-overflow: ellipsis;
        margin: 0.03rem 0;
      }
      strong {
        color: rgb(245, 75, 75);
        font-weight: 700;
        font-size: 0.15rem;
        display: block;
        width: 100%;
        text-align: center;
      }
    }
  }
}
</style>